// components/epsoide/epsoide.js
Component({
  lifetimes: {
    attached: function () {
      // 在组件实例进入页面节点树时执行
     let date = new Date()
     let year = date.getFullYear()
     let month = this.data.months[date.getMonth()]
     this.setData({
       year: year,
       month: month
     })
    },
    detached: function () {
      // 在组件实例被从页面节点树移除时执行
    },
  },
  /**
   * Component properties
   */
  properties: {
    index: {
      type: String,
      // 属性被改变时执行
      observer: function (newVal, oldVal, changedPath) {
        let val = newVal < 10 ? '0' + newVal : oldVal
        this.setData({
          _index: val
        })
      }
    }
  },

  /**
   * Component initial data
   */
  data: {
    months: [
      '一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'
    ],
    _index: 0,
    year: 0,
    month: String
  },
  /**
   * Component methods
   */
  methods: {

  }
})
